package com.concurrent.chapter1.concurrent03;

import java.util.concurrent.Semaphore;

public class Service {
	private boolean isFair = true;
	private Semaphore semaphore = new Semaphore(1, isFair);
	public void testMethod() {
		try {
			semaphore.acquire();
			System.out.println(Thread.currentThread().getName());
		} catch (Exception e) {
			e.printStackTrace();
		} finally {
			semaphore.release();
		}
	}
}
